package com.jash.labor.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jash.labor.context.Result;
import com.jash.labor.entity.Company;
import com.jash.labor.entity.Station;
import com.jash.labor.mapper.StationMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

@Service
public class StationService{


    @Resource
    private StationMapper stationMapper;


    public Object add(Station station){

        stationMapper.insert(station);

        return Result.SUCCESS;
    }
    public Object edit(Station station){

        stationMapper.updateById(station);

        return Result.SUCCESS;
    }

    public Object queryListPage(Integer pageNo,Integer pageSize){

        Page<Station> page = new Page<>(pageNo,pageSize);

        IPage iPage = stationMapper.selectPage(page,null);

        return new Result<>(iPage);

    }

    public Object laborQueryStationList(String content, Integer pageNo, Integer pageSize) {
        Page<HashMap> page = new Page<>(pageNo,pageSize);
        IPage<HashMap> iPage = stationMapper.laborQueryStationList(page,content);
        return new Result<>(iPage);
    }
    //查询历史岗位详情
    public Object queryHistoricalPositionDetails(Integer companyid,Integer pageNo, Integer pageSize) {

//        Page <Company>page = new Page(pageNo,pageSize);
//        QueryWrapper wrapper = new QueryWrapper();
        List<HashMap> list = stationMapper.queryHistoricalPositionDetails(companyid);
        return new Result<>(list);
    }

    public Object companyqueryListPage(String companyId, Integer pageNo, Integer pageSize) {
        List<HashMap> list = stationMapper.companyQueryStationList(companyId);
        return new Result<>(list);
    }
    public Object HistoricalPositionList(String companyid,Integer pageNo,Integer pageSize) {
        Page<HashMap> page = new Page<>(pageNo,pageSize);
        IPage<HashMap> iPage = stationMapper.HistoricalPositionList(page,companyid);
        return new Result<>(iPage);
    }
}
